package com.lt.bcra.controller.questionnaire;


import com.lt.bcra.controller.user.BcraPersonalInfoController;
import com.lt.bcra.exception.BaseException;
import com.lt.bcra.service.BcraModuleService;
import com.lt.bcra.result.ResultData;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * <p>
 * 模块设计表 前端控制器
 * </p>
 *
 * @author LuoTian
 * @since 2022-05-25
 */
@Api(tags = "问卷模块管理")
@CrossOrigin //跨域可以前端配置
@RestController
@RequestMapping("bcra/module")
public class BcraModuleController {
    private static Logger log = LoggerFactory.getLogger(BcraPersonalInfoController.class);

    @Autowired
    private BcraModuleService bcraModuleService;

    @GetMapping("/list/{questionnaireId}")
    @ApiOperation("条件查询某个问卷下所有模块")
    public ResultData listAll(@PathVariable Integer questionnaireId) throws BaseException {
        if (log.isDebugEnabled()) log.debug("条件查询某个问卷下所有模块 BcraModuleController");

        return bcraModuleService.selectByQuestionnaireId(questionnaireId);
    }
}

